using UnityEditor;
using UnityEngine;

namespace JufGame
{
	[CustomEditor(typeof(LOD_Trader))]
	public class Trader_Inspector : Editor
	{
		LOD_Trader trader;
		MonoScript monoScript;
		private void OnEnable()
		{
			trader = target as LOD_Trader;
			monoScript = MonoScript.FromMonoBehaviour(target as MonoBehaviour);
		}
		public override void OnInspectorGUI()
		{
			EditorGUILayout.BeginVertical();
			serializedObject.Update();
			
			EditorGUI.BeginDisabledGroup(true); // 开始禁用 GUI 控件
       		EditorGUILayout.ObjectField("Script", monoScript, typeof(MonoScript), false);
        	EditorGUI.EndDisabledGroup(); 
			EditorGUILayout.PropertyField(serializedObject.FindProperty("isDontDestroyOnLoad"), new GUIContent("不被场景加载摧毁"));
			EditorGUILayout.Space(0.5f);
			EditorGUILayout.PropertyField(serializedObject.FindProperty("viewCameras"), new GUIContent("视野相机"));
			EditorGUILayout.Space(0.5f);
			EditorGUILayout.PropertyField(serializedObject.FindProperty("ambMul"), new GUIContent("环境注意程度负载"));
			EditorGUILayout.Space(0.5f);
			EditorGUILayout.PropertyField(serializedObject.FindProperty("characters"), new GUIContent("交易对象集合"));
			EditorGUILayout.Space(0.5f);
			if(GUILayout.Button("获取场景全部LOD_Character"))
			{
				trader.UI_GetAllLODChararcters();
			}
			EditorGUILayout.PropertyField(serializedObject.FindProperty("availableResources"), new GUIContent("剩余可分配资源"));
			
			serializedObject.ApplyModifiedProperties();
			EditorGUILayout.EndVertical();
		}
	}
}
